package c.e.b.m.l;

import android.content.SharedPreferences;

/* compiled from: IidStore */
public class b {
    public static final String[] c = new String[]{"*", "FCM", "GCM", ""};
    public final SharedPreferences a;
    public final String b;

    /* JADX WARNING: Missing block: B:9:0x0046, code skipped:
            if (r0.isEmpty() != false) goto L_0x0048;
     */
    public b(c.e.b.c r4) {
        /*
        r3 = this;
        r3.<init>();
        r4.a();
        r0 = r4.a;
        r1 = "com.google.android.gms.appid";
        r2 = 0;
        r0 = r0.getSharedPreferences(r1, r2);
        r3.a = r0;
        r4.a();
        r0 = r4.c;
        r0 = r0.e;
        if (r0 == 0) goto L_0x001b;
    L_0x001a:
        goto L_0x0049;
    L_0x001b:
        r4.a();
        r4 = r4.c;
        r0 = r4.b;
        r4 = "1:";
        r4 = r0.startsWith(r4);
        if (r4 != 0) goto L_0x0033;
    L_0x002a:
        r4 = "2:";
        r4 = r0.startsWith(r4);
        if (r4 != 0) goto L_0x0033;
    L_0x0032:
        goto L_0x0049;
    L_0x0033:
        r4 = ":";
        r4 = r0.split(r4);
        r0 = r4.length;
        r1 = 4;
        r2 = 0;
        if (r0 == r1) goto L_0x003f;
    L_0x003e:
        goto L_0x0048;
    L_0x003f:
        r0 = 1;
        r0 = r4[r0];
        r4 = r0.isEmpty();
        if (r4 == 0) goto L_0x0049;
    L_0x0048:
        r0 = r2;
    L_0x0049:
        r3.b = r0;
        return;
        */
        throw new UnsupportedOperationException("Method not decompiled: c.e.b.m.l.b.m1862init(c.e.b.c):void");
    }

    /* JADX WARNING: Missing exception handler attribute for start block: B:19:0x0067 */
    /* JADX WARNING: Can't wrap try/catch for region: R(5:16|17|18|19|20) */
    public final java.lang.String a() {
        /*
        r6 = this;
        r0 = r6.a;
        monitor-enter(r0);
        r1 = r6.a;	 Catch:{ all -> 0x0070 }
        r2 = "|S||P|";
        r3 = 0;
        r1 = r1.getString(r2, r3);	 Catch:{ all -> 0x0070 }
        if (r1 != 0) goto L_0x0010;
    L_0x000e:
        monitor-exit(r0);	 Catch:{ all -> 0x0070 }
        return r3;
    L_0x0010:
        r2 = 8;
        r1 = android.util.Base64.decode(r1, r2);	 Catch:{ IllegalArgumentException -> 0x002a, InvalidKeySpecException -> 0x0028, IllegalArgumentException | NoSuchAlgorithmException | InvalidKeySpecException -> 0x0026 }
        r4 = "RSA";
        r4 = java.security.KeyFactory.getInstance(r4);	 Catch:{ IllegalArgumentException -> 0x002a, InvalidKeySpecException -> 0x0028, IllegalArgumentException | NoSuchAlgorithmException | InvalidKeySpecException -> 0x0026 }
        r5 = new java.security.spec.X509EncodedKeySpec;	 Catch:{ IllegalArgumentException -> 0x002a, InvalidKeySpecException -> 0x0028, IllegalArgumentException | NoSuchAlgorithmException | InvalidKeySpecException -> 0x0026 }
        r5.<init>(r1);	 Catch:{ IllegalArgumentException -> 0x002a, InvalidKeySpecException -> 0x0028, IllegalArgumentException | NoSuchAlgorithmException | InvalidKeySpecException -> 0x0026 }
        r1 = r4.generatePublic(r5);	 Catch:{ IllegalArgumentException -> 0x002a, InvalidKeySpecException -> 0x0028, IllegalArgumentException | NoSuchAlgorithmException | InvalidKeySpecException -> 0x0026 }
        goto L_0x0042;
    L_0x0026:
        r1 = move-exception;
        goto L_0x002b;
    L_0x0028:
        r1 = move-exception;
        goto L_0x002b;
    L_0x002a:
        r1 = move-exception;
    L_0x002b:
        r4 = new java.lang.StringBuilder;	 Catch:{ all -> 0x0070 }
        r4.<init>();	 Catch:{ all -> 0x0070 }
        r5 = "Invalid key stored ";
        r4.append(r5);	 Catch:{ all -> 0x0070 }
        r4.append(r1);	 Catch:{ all -> 0x0070 }
        r1 = r4.toString();	 Catch:{ all -> 0x0070 }
        r4 = "ContentValues";
        android.util.Log.w(r4, r1);	 Catch:{ all -> 0x0070 }
        r1 = r3;
    L_0x0042:
        if (r1 != 0) goto L_0x0046;
    L_0x0044:
        monitor-exit(r0);	 Catch:{ all -> 0x0070 }
        return r3;
    L_0x0046:
        r1 = r1.getEncoded();	 Catch:{ all -> 0x0070 }
        r4 = "SHA1";
        r4 = java.security.MessageDigest.getInstance(r4);	 Catch:{ NoSuchAlgorithmException -> 0x0067 }
        r1 = r4.digest(r1);	 Catch:{ NoSuchAlgorithmException -> 0x0067 }
        r4 = 0;
        r5 = r1[r4];	 Catch:{ NoSuchAlgorithmException -> 0x0067 }
        r5 = r5 & 15;
        r5 = r5 + 112;
        r5 = r5 & 255;
        r5 = (byte) r5;	 Catch:{ NoSuchAlgorithmException -> 0x0067 }
        r1[r4] = r5;	 Catch:{ NoSuchAlgorithmException -> 0x0067 }
        r5 = 11;
        r3 = android.util.Base64.encodeToString(r1, r4, r2, r5);	 Catch:{ NoSuchAlgorithmException -> 0x0067 }
        goto L_0x006e;
    L_0x0067:
        r1 = "ContentValues";
        r2 = "Unexpected error, device missing required algorithms";
        android.util.Log.w(r1, r2);	 Catch:{ all -> 0x0070 }
    L_0x006e:
        monitor-exit(r0);	 Catch:{ all -> 0x0070 }
        return r3;
    L_0x0070:
        r1 = move-exception;
        monitor-exit(r0);	 Catch:{ all -> 0x0070 }
        throw r1;
        */
        throw new UnsupportedOperationException("Method not decompiled: c.e.b.m.l.b.a():java.lang.String");
    }
}
